AnnieRoot.index=AnnieRoot.index||{};
index.Index=function(){
	var s = this;
	annie.Sprite.call(s);
	/*_a2x_need_start*/s.m_mc=null;/*_a2x_need_end*/
	annie.initRes(s,"index","Index");
    s.m_mc.visible=false;
    var mp3=annie.getResource("index","BSound");
    var sound=new annie.Sound(mp3);
    sound.play(0,Number.MAX_VALUE);
    annie.globalDispatcher.addEventListener("onLoaded", function (e) {
        switch (e.data) {
            case 0:
                s.addChildAt(new index.MainMc(), 0);
                break;
            case 1:
                s.m_mc.visible=true;
                s.removeChildAt(0);
                s.addChildAt(new index.MakeMc(), 0);
                break;
            case 2:
                s.removeAllChildren();
                s.addChildAt(new index.Result(), 0);

        }
    });
    s.addEventListener(annie.Event.ADD_TO_STAGE,function (e) {
        s.m_mc.y=s.m_mc.y/s.stage.desHeight*s.stage.viewRect.height+s.stage.viewRect.y;
    });
    s.m_mc.mouseChildren=false;
    s.m_mc.addEventListener(annie.MouseEvent.CLICK,function (e) {
        if(s.m_mc.currentFrame==1){
            s.m_mc.nextFrame();
            sound.stop();
        }else{
            s.m_mc.prevFrame();
            sound.play();
        }
    })
};
A2xExtend(index.Index,annie.Sprite);
